<template>
	<el-container>
		<el-main class='x-main-edit'>
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-tabs type="border-card" v-model="page_tag">
					<!---->
					<!---->
					<el-tab-pane :label="page_info.title" name="1">
						<el-form-item label="名称" prop="cnetwork_name">
							<el-input v-model="form.cnetwork_name" class="x-input-60"></el-input>
						</el-form-item>
						<el-form-item label="图片" prop="cnetwork_pic">
							<x-upload-imgs ref="uploadEle" :sortable="true" :max-num="1"
										   :rules="({ maxSize: 0.5})"
										   :img_root="page_info.static_file_root"
										   v-bind:value.sync="form.cnetwork_pic"
										   :remote-fuc="g_page.funcUpdateImg"
										   :before-upload="g_page.funcUpdateImgBefore"/>
						</el-form-item>
						<el-form-item label="省市区" prop="city">
							<CompSelectCity v-model="form.city"></CompSelectCity>
						</el-form-item>
						<el-form-item label="地址" prop="cnetwork_address">
							<el-input type="textarea" :rows="5" v-model="form.cnetwork_address"></el-input>
						</el-form-item>
						<el-form-item label="经纬度" prop="cnetwork_lng">
							经度:
							<el-input style="width: 20%;" v-model="form.cnetwork_lng"></el-input>
							纬度:
							<el-input style="width: 20%;" v-model="form.cnetwork_lat"></el-input>
							<div class="x-alert">
								<span>坐标说明，大的经度，小的纬试</span><br/>
								<span>坐标获取<a target="_blank" href="https://lbs.qq.com/getPoint/">点击前往</a></span>
							</div>
						</el-form-item>
						<el-form-item label="误差距离" prop="cnetwork_error_span_m" ref="cnetwork_error_span_m">
							<el-input-number v-model="form.cnetwork_error_span_m" :step="1"></el-input-number>
							米
							<div class="x-alert">
								<span>用车还车，容错误差</span><br/>
							</div>
						</el-form-item>
						<el-form-item label="车位数量" prop="cnetwork_car_total" ref="cnetwork_car_total">
							<el-input-number v-model="form.cnetwork_car_total" :step="1"></el-input-number>
						</el-form-item>
						<el-form-item label="网点说明" prop="cnetwork_desc">
							<el-input type="textarea" v-model="form.cnetwork_desc" class="x-input-60"></el-input>
						</el-form-item>
						<el-form-item label="停车费说明" prop="cnetwork_desc_stop">
							<el-input type="textarea" v-model="form.cnetwork_desc_stop" class="x-input-60"></el-input>
						</el-form-item>
						<el-form-item label="网点开发人与联系人" prop="cnetwork_user_desc">
							<el-input type="textarea" v-model="form.cnetwork_user_desc" class="x-input-60" placeholder=""></el-input>
						</el-form-item>
						<el-form-item label="标签" prop="cnetwork_tag">
							<el-input v-model="form.cnetwork_tag" class="x-input-60"></el-input>
							<div class="x-alert">
								<span>多个带英文逗号分隔</span>
							</div>
						</el-form-item>
						<el-form-item label="状态" prop="cnetwork_hide">
							<el-switch v-model="form.cnetwork_hide"
									   active-color="#13ce66"
									   :active-value="1" active-text="隐藏"
									   :inactive-value="0" inactive-text="显示">
							</el-switch>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane v-if="false" label="模板" name="2">
						<el-form-item label="应用模板" prop="reply_app_file" ref="reply_app_file">
							<el-col :span="6">
								<el-input v-model="form.reply_app_file" placeholder="默认：t_001"/>
							</el-col>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
				</el-tabs>
			</el-form>
			<!---->
			<!---->
			<!-- 按钮部分 -->
			<div class="save_wrap">
				<el-button @click="g_page.funcBack" size="mini">返回</el-button>
				<el-button type="success" @click="g_page.funcSave" size="mini">保存</el-button>
				<el-checkbox v-if="page_info.is_admin_edit" style="margin-left: 10px;" label="保存后停留" v-model="checked"/>
			</div>
			<!---->
			<!---->
			<!---->
		</el-main>
	</el-container>
</template>

<script>
	import Tinymce from '@/components/Tinymce'
	import CompSelectCity from '@/components/CompSelectCity'

	export default {
		components: {
			Tinymce,
			CompSelectCity
		},
		data() {
			let page_data = {}
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted')
			console.log(this.$route.query)

			this.g_page.funcSetVue(this)
			//
			this.g_page.funcSetApiUrlEdit('/xadmin/app_car/app_car__network__edit')
			this.g_page.funcSetApiUrlSave('/xadmin/app_car/app_car__network__edit/save')
			let page = this
			//验证
			this.form_rules = {
				__test: [{
					required: true,
					message: '请输入原密码',
					trigger: 'blur'
				}]
			}

			let data = this.$route.query
			this.g_page.funcEdit(data)
		},
		methods: {
			funcShowDialogAfter() {
				console.log('funcShowDialogAfter')

				this.$nextTick(() => {
					this.$refs['abc_long_00'].setContent(this.form.abc_long_00)
				})
			},
			//保存之前
			funcSaveBefore(data) {
				console.log('funcSaveBefore', data)

				// data.abc_str_00 = this.g_page.funcImgArrToStr(data.abc_str_00_imgs)

				return data
			}
		}
	}
</script>
